

<form method="post" action="<?php echo $this->Html->url('/home/searchproperty'); ?>">
    <div id="h_container_search">
        <h1 style="text-transform: uppercase;color: #66A9D6;font-size: 24px;"><?php echo __('Search Propertyes');?></h1>
        <div style="margin: 0px 0px 10px 0px">
        <?php
        echo $this->Form->input('Search.search_name', array(
            'label' => false,
            'type' => 'text',
            'class' => 'h_width_search',
            'div' => false,
            'style' => 'height:44px;margin-left:0px;width: 575px;'
        ));
        ?>
        <button type="submit" class="btn btn-danger h_button_search" style="height: 44px;width: 133px;"><?php echo __('Search');?></button>
        </div>
        <?php
        echo $this->Form->input('Search.category', array(
            'label' => false,
            'type' => 'select',
            'options' => $this->requestAction('Common/search'),
            'class' => 'h_width_category',
            'div' => false,
            'style' => 'width: 348px;'
        ));
        ?>
        <?php
        echo $this->Form->input('Search.location', array(
            'label' => false,
            'type' => 'select',
            'options' => array('' => __('Location'), 37 => __('Ho Chi Minh City'), 38 => __('Ha Noi')),
            'class' => 'h_width_location',
            'div' => false,
            'style' => 'width: 340px;'
        ));
        ?>
        <div id="container_search_home" class="common_search">
            <?php
            echo $this->Form->input('Search.min_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchHomeMinPrice'),
                'class' => 'h_width_bed_fix category_none' ,
                'div' => false,
                'style' => 'margin-left:0px;'
            ));
            ?>
            <?php
            echo $this->Form->input('Search.max_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchHomeMaxPrice'),
                'class' => 'h_width_bed_fix category_none',
                'div' => false
            ));
            ?>



            <?php
            echo $this->Form->input('Search.bed_min', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchHomeMinBed'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            echo $this->Form->input('Search.bed_max', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchHomeMaxBed'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            ?>
        </div>
        <div id="container_search_villa" class="common_search">
            <?php
            echo $this->Form->input('Search.min_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchVillaMinPrice'),
                'class' => 'h_width_bed_fix category_none' ,
                'div' => false,
                'style' => 'margin-left:0px;'
            ));
            ?>
            <?php
            echo $this->Form->input('Search.max_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchVillaMaxPrice'),
                'class' => 'h_width_bed_fix category_none',
                'div' => false
            ));
            ?>



            <?php
            echo $this->Form->input('Search.bed_min', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchVillaMinBed'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            echo $this->Form->input('Search.bed_max', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchVillaMaxBed'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            ?>
        </div>
        <div id="container_search_office" class="common_search">
            <?php
            echo $this->Form->input('Search.min_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchOfficeMinPrice'),
                'class' => 'h_width_bed_fix category_none' ,
                'div' => false,
                'style' => 'margin-left:0px;'
            ));
            ?>
            <?php
            echo $this->Form->input('Search.max_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchOfficeMaxPrice'),
                'class' => 'h_width_bed_fix category_none',
                'div' => false
            ));
            ?>



            <?php
            echo $this->Form->input('Search.size_min', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchOfficeMinSize'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            echo $this->Form->input('Search.size_max', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchOfficeMaxSize'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            ?>
        </div>
        <div id="container_search_shop" class="common_search">
            <?php
            echo $this->Form->input('Search.min_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchShopMinPrice'),
                'class' => 'h_width_bed_fix category_none' ,
                'div' => false,
                'style' => 'margin-left:0px;'
            ));
            ?>
            <?php
            echo $this->Form->input('Search.max_price', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchShopMaxPrice'),
                'class' => 'h_width_bed_fix category_none',
                'div' => false
            ));
            ?>



            <?php
            echo $this->Form->input('Search.size_min', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchShopMinSize'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            echo $this->Form->input('Search.size_max', array(
                'label' => false,
                'type' => 'select',
                'options' => $this->requestAction('Common/searchShopMaxSize'),
                'class' => 'h_width_bed_fix',
                'div' => false
            ));
            ?>
        </div>
        
        
    </div>
    <?php echo $this->element('location_filter');?>

</form>
<style>
    #h_container_search .common_search{
        float: none;
    }
</style>
<script>
    function selectCategory(choose){
        $('.common_search').hide();
        $('.common_search').find('input').attr('disabled',true);
        $('.common_search').find('select').attr('disabled',true);
        //
        $(choose).show();
        $(choose).find('input').attr('disabled',false);
        $(choose).find('select').attr('disabled',false);
    }
    $(document).ready(function(){
        selectCategory('#container_search_home');
        $('#SearchCategory').change(function(){
               switch($(this).val()){
                   case '31':{
                        selectCategory('#container_search_home');
                        break;
                   }
                   case '32':{
                          selectCategory('#container_search_home');
                        break; 
                   }
                   case '33':{
                         selectCategory('#container_search_villa');
                        break;  
                   }
                   case '34':{
                         selectCategory('#container_search_shop');
                        break;  
                   }
                   case '35':{
                           selectCategory('#container_search_office');
                        break;
                   }
                   default:{
                        selectCategory('#container_search_home');
                        break;
                   }
               }
	});
        
    });
</script>